package com.example.springboot_logdatabase.service;

import com.example.springboot_logdatabase.dao.SysLogDao;
import com.example.springboot_logdatabase.entity.SysLog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;

@Service
//     https://blog.csdn.net/qq_38650808/article/details/105998110
public class SysLogDaoImp implements SysLogDao {

    @Autowired
    private JdbcTemplate jdbcTemplate;

    @Override
    public void saveSysLog(SysLog syslog) {
        StringBuffer sql = new StringBuffer("insert into sys_log VALUES (NULL,?,?,?,?,?,?,?)");
        String sql2=sql.toString();
        jdbcTemplate.update(sql2,syslog.getUsername(),syslog.getOperation(),syslog.getTime(),syslog.getMethod(),syslog.getParams(),syslog.getIp(),syslog.getCreateTime());
    }
}

